/**
 * 
 */
package com.seguriapp.activities;

import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.view.WindowManager;
import android.widget.LinearLayout;

import com.seguriapp.R;

/**
 * @author Pablo
 * 
 */
public class BaseActivity extends Activity {

	private ProgressDialog dialog;

	protected void mostrarDialogoEsperaSinCancel(final Context context) {
		if (!((Activity) context).isFinishing()) {
			dialog = ProgressDialog.show(context, "", "Cargando", true, false,
					null);
			dialog.setContentView(R.layout.dialog_custom_progress);
			WindowManager.LayoutParams lp = dialog.getWindow().getAttributes();
			lp.dimAmount = 0.0f;
			dialog.getWindow().setAttributes(lp);
			dialog.getWindow().addFlags(
					WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
			LinearLayout layoutRoundPop = (LinearLayout) dialog
					.findViewById(R.id.layoutRound);
			layoutRoundPop.getBackground().setAlpha(180);
		}
	}

	protected void ocultarDialogo() {
		if (dialog != null && dialog.isShowing()) {
			dialog.dismiss();
		}
	}
}
